home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 301-325 / 311 / crobots / thorin.r < prev    next >
Text File  |  1995-03-14  |  2KB  |  71 lines

  1. Asian Spec.
  2. Na Sy Chuang
  3. /*thorin stoutfoot algorithm ......
  4.    charge at foe and keep charging until either you die or he does */
  5.  
  6. /* Thorin Stoutfoot (tm) is copyrighted 1981 by Na Sy Chuang
  7.    used without permission or endorsement.                        */
  8.  
  9.  
  10. /* only one routine !! */
  11. main()
  12. {
  13.      int    Dir,Range;
  14.  
  15.      Dir=Range=0;
  16.      while (1) /* main loop */
  17.      {
  18.           drive(rand(360),100);
  19.           while (!(Range=scan(Dir,10)))
  20.                Dir += 20;
  21.  
  22.           if (!speed())
  23.              while (!speed())
  24.                    drive(rand(360,100));
  25.  
  26.           Dir -= 20;
  27.  
  28.           while (!(Range=scan(Dir,5)))
  29.                Dir += 5;
  30.  
  31.           while (speed() > 49)
  32.           {
  33.                 cannon(Dir,Range);
  34.                 drive(Dir,0);
  35.  
  36.           }
  37.  
  38.           drive(Dir,100);
  39.  
  40.           while (Range = scan(Dir,5))
  41.           {
  42.                 while (Range = scan(Dir,5))
  43.                       cannon(Dir,Range);
  44.  
  45.                 if (Range = scan(Dir, 10))
  46.                 {
  47.                      int k;
  48.  
  49.                      Dir -= 10;
  50.                      k = Dir;
  51.                      while ((!(Range = scan(Dir,5))) &&
  52.                             (Dir - k <= 30))
  53.                            Dir += 5;  /* fine tuning */
  54.  
  55.                      while (speed() > 49)
  56.                            drive(Dir,0);
  57.  
  58.                      drive(Dir, 100);
  59.                  }
  60.  
  61.           }  /* if out of this loop? probably passed by.  turn around */
  62.  
  63.          Dir += 170;
  64.          while (speed() > 49)
  65.                drive(0,0);
  66.  
  67.     } /* while */
  68.  
  69. }
  70.  
  71.